#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=icon.ico
#AutoIt3Wrapper_Outfile=cc_x86.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Description=Change Computer Name
#AutoIt3Wrapper_Res_Fileversion=1.0
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#AutoIt3Wrapper_Res_Field=Made By|Parinya Sukhaporamet
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.1
 Author:         Parinya Sukhaporamet

 Script Function:
	Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
Local $comname = RegRead ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName","ComputerName")
;InputBox features: Title=Yes, Prompt=Yes, Default Text=Yes
If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
$sInputBoxAnswer = InputBox("Change Computer Name","Computer Name",$comname)
Select
	Case @Error = 0 ;OK - The string returned is valid
		RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName","ComputerName","REG_SZ",$sInputBoxAnswer)
		Sleep(500)
		If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
		$iMsgBoxAnswer = MsgBox(308,"Change Computer Name","Restart computer required")
		Select
			Case $iMsgBoxAnswer = 6 ;Yes
				Shutdown(6,"restart for change name computer")
			Case $iMsgBoxAnswer = 7 ;No
				Exit
			EndSelect
	Case @Error = 1 ;The Cancel button was pushed
		Exit
	Case @Error = 3 ;The InputBox failed to open
		MsgBox (4128,"Change Computer Name","The InputBox failed to open. Try again",5)
EndSelect



